﻿using AnimeLibrary.App_Code;
using System;
using System.Data;

namespace AnimeLibrary
{
    public partial class details : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
                BindData();
        }


        private void BindData()
        {
            if ((Request.QueryString["item"] != null) && (Request.QueryString["item"].ToString().Length > 0))
                BindData(string.Format("SELECT * FROM tbl_anime_library WHERE ([ID] = {0})", Request.QueryString["Item"].ToString().Replace("'", "''")));
        }

        private void BindData(string commandText)
        {
            try
            {
                DataTable dtAnimeItem = ReadOp.GetDataTable(Request.MapPath("App_Data\\AnimeLibrary.accdb"), commandText);

                rptAnimeLibraryItem.DataSource = dtAnimeItem;
                rptAnimeLibraryItem.DataBind();
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
    }
}